package com.lancoo.rxretrofitlibrary.Api;


import android.support.annotation.StringDef;

import com.lancoo.cpbase.authentication.base.CurrentUser;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * 存储用户的信息
 * Created by tangminglong on 17/8/10.
 */

public class UserInfo {

    /**
     * TOKEN
     */
    public static String Token;
    /**
     * 当前学生ID
     */
    public static String StuId ;
    /**
     * 学生姓名
     */
    public static String StuName;
    /**
     * 学科ID
     */
    public static String SubjectId;
    /**
     * 学科名称
     */
    public static String SubjectName;
    /**
     * 测试等级
     */
    public static @StageID String StageNo;
    /**
     * 当前学习ID
     */
    public static String SchoolId;


    /**
     * 班级名称
     */
    public static String ClassName;
    /**
     * 头像地址
     */
    public static String PhotoUrl;

    /**
     * 当前作答的试卷状态
     */
    public static int PaperStatus;

    /**
     * 当前作答试题的来源
     */
    public static int PaperFrom;

    /*
    * 当前学习阶段
    * */
    public static String GlobalGrade;

    /*
    * 学科信息
    * */
    public static String BaseSubjectID;

    /*
    * 获取系统保存图片的基础地址
    * */
    public static String BasePhotoPath;



    public static void init() {
        Token = CurrentUser.Token;
        StuId = CurrentUser.UserID;
        StuName = CurrentUser.UserName;
        GlobalGrade = CurrentUser.GlobalGrade;
        SubjectId = "C";
        SubjectName = "英语";
        setStageNo(CurrentUser.GlobalGrade);
        SchoolId = CurrentUser.SchoolID;
        ClassName = CurrentUser.GroupName;
        PhotoUrl = CurrentUser.PhotoPath;
        BaseSubjectID = "S2-English";
    }

    public static boolean checkStage(@StageID String stageID){
        return StageNo.equals(stageID);
    }

    public static void setStageNo(String testLayer) {
        /**
         * A;小学 B：初中 C：高中
         * */

        if(testLayer.equals("K7")||testLayer.equals("K8")||testLayer.equals("K9")){
            StageNo = JUNIOR_SCHOOL;
        }else if(testLayer.equals("K10")||testLayer.equals("K11")||testLayer.equals("K12")){
            StageNo = SENIOR_SCHOOL;
        }

    }

    public final static String JUNIOR_SCHOOL = "B",SENIOR_SCHOOL = "C";
    @StringDef({JUNIOR_SCHOOL,SENIOR_SCHOOL})
    @Retention(RetentionPolicy.SOURCE)
    public @interface StageID{

    }
}
